/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.moviedownloader.DbModel;

import java.util.Objects;


/**
 *
 * @author martin
 */
public class Person{
    
    private String name;
    private String csfdAdress;
    private Long id;
    private int csfdId = -1;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCsfdAdress() {
        return csfdAdress;
    }

    public void setCsfdAdress(String csfdAdress) {
        this.csfdAdress = csfdAdress;
        csfdId = Integer.parseInt(
                csfdAdress.split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)")[1]);
    }
    
    public int getCsfdId(){
        return this.csfdId;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getCandidateKey() {
        return csfdId;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 59 * hash + Objects.hashCode(this.csfdId);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Person other = (Person) obj;
        if (!Objects.equals(this.csfdId, other.csfdId)) {
            return false;
        }
        return true;
    }
    
    

    @Override
    public String toString() {
        return "Person{" + "name=" + name + ", csfdAdress=" + csfdAdress + ", id=" + id + ", csfdId=" + csfdId + '}';
    }


}
